home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / texinfo-.1 / info / pc_term.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-06  |  3.4 KB  |  175 lines

  1. /* pc_term.c */
  2.  
  3. /* This file is part of the MSDOS-DJGPP-port of the GNU standalone
  4.    Info-reader
  5.  
  6.    Copyright (C) Hans-Bernhard Broeker
  7.  
  8.    This program is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2, or (at your option)
  11.    any later version.
  12.  
  13.    This program is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this program; if not, write to the Free Software
  20.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.    Written by Hans-Bernhard Broeker (softbrek@POOL.Informatik.RWTH-Aachen.DE)
  23. */
  24.  
  25. #include <stdio.h>
  26. #include <pc.h>
  27. #include <gppconio.h>
  28. #include "pc_term.h"
  29. #include "terminal.h"
  30. #include "termdep.h"
  31.  
  32. #define max(x,y) ((x)>(y) ? (x) : (y))
  33. #define min(x,y) ((x)<(y) ? (x) : (y))
  34. #define keywait  do {char dummy=0;\
  35.                      fflush(stdout);\
  36.                      while (!kbhit()) ;\
  37.                      dummy=getkey();\
  38.                  } while (0);
  39.  
  40. static struct text_info pc_info; /* struct to hold the conio-status */
  41.  
  42. void pc_begin_inverse()
  43. {
  44.     textbackground(7);
  45.     textcolor(0);
  46. }
  47.  
  48. void pc_end_inverse()
  49. {
  50.     textbackground(0);
  51.     textcolor(7);
  52. }
  53.  
  54. void pc_prep_terminal()
  55. {
  56.   textattr(0x07);
  57. }
  58.  
  59. void pc_unprep_terminal()
  60. {
  61.     ScreenClear(); /* to leave behind a clean screen */
  62. }
  63.  
  64. void pc_up_line()
  65. {
  66.     int x, y;
  67.     ScreenGetCursor(&y, &x);
  68.     ScreenSetCursor(max(y-1, 0), x);
  69. }
  70.  
  71. void pc_down_line()
  72. {
  73.     int x, y;
  74.     ScreenGetCursor(&y, &x);
  75.     ScreenSetCursor(min(screenheight-1, y+1), x);
  76. }
  77.  
  78. void pc_clear_screen()
  79. {
  80.     ScreenClear();
  81. }
  82.  
  83. void pc_clear_to_eol()
  84. {
  85.     clreol(); /* perhaps to be replaced by a loop */
  86. }
  87.  
  88. void pc_get_screen_size()
  89. {
  90.     screenwidth  = ScreenCols();
  91.     screenheight = ScreenRows();
  92. }
  93.  
  94. void pc_goto_xy(x, y)
  95. int x, y;
  96. {
  97.     ScreenSetCursor(y, x); /* yes, pc.h says ...(row, column) !! */
  98. }
  99.  
  100. void pc_initialize_terminal(term_name)
  101.     char *term_name;
  102. {
  103.     gppconio_init();
  104.     gettextinfo(&pc_info);
  105.     screenwidth  = ScreenCols();
  106.     screenheight = ScreenRows();
  107. }
  108.  
  109. void pc_new_terminal(term_name)
  110.     char *term_name;
  111. {
  112.     pc_initialize_terminal(term_name);
  113. }
  114.  
  115. void pc_put_text(string)
  116. char *string;
  117. {
  118.     cputs(string);
  119. }
  120.  
  121. void pc_ring_bell()
  122. {
  123.     printf("%c",'\a');
  124. }
  125.  
  126. void pc_write_chars(string, nchars)
  127.     char *string;
  128.     int nchars;
  129. {
  130.     cprintf("%.*s",nchars, string);
  131. }
  132.  
  133. void pc_scroll_terminal(start, end, amount)
  134.     int start, end, amount;
  135. {
  136.     movetext(pc_info.winleft, start, pc_info.winright, end,
  137.         pc_info.winleft, start+amount);
  138. }
  139.  
  140. int       tputs(char *a, int b, int (*c)())
  141. {
  142.   perror("tputs");
  143. }
  144.  
  145. char*     tgoto(char*a, int b, int c)
  146. {
  147.   perror("tgoto");
  148. }
  149.  
  150. int       tgetnum(char*a)
  151. {
  152.   perror("tgetnum");
  153. }
  154.  
  155. int       tgetflag(char*a)
  156. {
  157.   perror("tgetflag");
  158. }
  159.  
  160. char*     tgetstr(char *a, char **b)
  161. {
  162.   perror("tgetstr");
  163. }
  164.  
  165. int       tgetent(char*a, char*b)
  166. {
  167.   perror("tgetent");
  168. }
  169.  
  170. int       sigblock(int a)
  171. {
  172.   return 0;
  173. }
  174.  
  175.